home *** CD-ROM | disk | FTP | other *** search
/ Pascal Super Library / Pascal Super Library (CW International)(1997).bin / MATH / NRPAS13 / KSONE.PAS < prev    next >
Pascal/Delphi Source File  |  1991-04-29  |  610b  |  27 lines

  1. PROCEDURE ksone(VAR data: gldarray; n: integer; VAR d,prob: real);
  2. (* Programs using routine KSONE must define the type
  3. TYPE
  4.    gldarray = ARRAY [1..n] OF real;
  5. in the main routine. *)
  6. VAR
  7.    j: integer;
  8.    fo,fn,ff,en,dt: real;
  9. BEGIN
  10.    sort(n,data);
  11.    en := n;
  12.    d := 0.0;
  13.    fo := 0.0;
  14.    FOR j := 1 TO n DO BEGIN
  15.       fn := j/en;
  16.       ff := func(data[j]);
  17.       IF (abs(fo-ff) > abs(fn-ff)) THEN BEGIN
  18.          dt := abs(fo-ff)
  19.       END ELSE BEGIN
  20.          dt := abs(fn-ff)
  21.       END;
  22.       IF (dt > d) THEN d := dt;
  23.       fo := fn
  24.    END;
  25.    prob := probks(sqrt(en)*d)
  26. END;
  27.